<div class="sc-cnt-publicacao">
        
   
    <div class="content-tb nowid e-cnt-men">
        <div class="tl-pag">Lista de Testes</div>
        
        <table class="nrmprd">          
        <?php foreach($this->result as $key => $row){ 
            
            $query = 'SELECT SQL_CACHE r.* FROM PUBLST_RANALU r '
                .' WHERE r.PUL_ID = '.$row['PUL_ID']
                .' AND r.ALU_ID = '.$row['ALU_ID'];
            $publst = $this->db->fetchRow($query);
            
            
            $img = '';
            $imgs = glob('public/upload/listaexercicio/'.$row['LTX_ID'].'.*');
            foreach ($imgs as $src) {
                if(strlen($src) > 3) $img = $this->urlbase.'/'.$src;
            }
        ?>
            <tr>
                <td style="width: 250px">
                    <?php echo $row['PUL_NOM']; ?>
                </td>    
                <td style="width: 200px">
                    <div class="lst_exe_inf">
                        Encerramento<br/>
                        <span class="inf_txt">
                            <?php echo substr(Datetools::invertDH_D($row['PUL_DATENC']),0,5); ?> 
                        </span>
                        &nbsp; às &nbsp; 
                        <span class="inf_txt">
                            <?php echo Datetools::hora_hm($row['PUL_HORENC']); ?>
                        </span>
                    </div>
                </td>
                <td style="width: 100px" align="center">
                    <div class="lst_exe_inf">
                        Status<br/>
                        <span class="inf_txt">
                        <?php
                            if($row['PUL_STA'] == 1) echo 'Aberta';
                            else if($row['PUL_STA'] == 2) echo 'Encerrada';
                        ?>
                        </span>
                    </div>
                </td>
                <td style="width: 100px" align="center">
                    <?php if($row['PUL_STA'] == 2){ ?>
                    <div class="lst_exe_inf">
                        Nota<br/>
                        <span class="inf_txt">
                            <?php echo $publst['PLA_POR']; ?>
                        </span>
                    </div>
                    <?php } else echo '--'; ?>
                </td>
                <?php if(strlen($img) > 2){ ?>
                <td class="bc bc-cmp"><a class="btn btn-cm b-vm" href="<?php echo $img; ?>" target="_blank">Baixar Lista</a></td>
                <?php } ?>
                <td class="bc bc-cmp"><a class="btn btn-cm" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit', 'id' => $row['PUL_ID'])); ?>">Grade de respostas</a></td>
                <?php if($row['PUL_STA'] == 2){ ?>
                <td class="bc bc-cmp icn_exp_tb" itemid="<?php echo $row['PUL_ID']?>"><a class="btn btn-cmp" href="javascript:void(0)">Resultado</a></td>
                <?php } ?>
            </tr>
            <?php if($row['PUL_STA'] == 2){ ?>
            <tr class="cntsubitem-<?php echo $row['PUL_ID']?>" style="display:none;">
                <td colspan="4">
                    <?php /* <span class="icn_exp_cont rot90" itemid="<?php echo $row['PUL_ID']?>"></span> Resultado */?>
                    <ul class="lst_res_alu" style="display:block;">
                    <?php
                    
                        $query = 'SELECT p.*, d.DCP_NOM' 
                                .' FROM PUBLST_QSTDISALU p, DISCIPLINA d'
                                .' WHERE  p.DCP_ID = d.DCP_ID AND PUL_ID = '.$row['PUL_ID']
                                .' AND ALU_ID = '.$this->aluno['ALU_ID'];
                        $disc = $this->db->fetchAll($query);
                        foreach($disc as $dis){
                            echo '<li>'.$dis['DCP_NOM'].'<span class="port">'.$dis['PQD_POR'].'%</span></li>';
                        }
                        
                        
                    ?>
                        <ul>
                </td>
            </tr>
            <?php } ?>
        <?php
            if($row['PUL_STA'] == 1) $status = $row['PUL_STA'];
            } ?>
        </table>
    </div>
    
</div>
<?php
if($status == 1) echo '<script> setInterval(function(){ window.location.href = URLBASE+\'/\'+CONTROL; }, 60000); </script>'; 
?>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
 
